package com.tiancheng.onecode.service;

import com.baomidou.mybatisplus.extension.service.IService;
import com.tiancheng.onecode.entity.Member;
import com.tiancheng.onecode.entity.MemberOrder;
import com.tiancheng.onecode.model.request.admin.QueryOrderReq;
import com.tiancheng.onecode.model.request.admin.StatisticsMerchantOrderReq;
import com.tiancheng.onecode.model.request.admin.StatisticsUserOrderReq;
import com.tiancheng.onecode.model.request.api.PayOrderRequest;
import com.tiancheng.onecode.model.response.PageInfo;
import com.tiancheng.onecode.model.response.admin.*;
import com.tiancheng.onecode.model.response.api.OrderPayApiRes;
import com.tiancheng.onecode.model.response.api.QueryMerchantApiRes;
import com.tiancheng.onecode.model.response.api.QueryOrderDetailApiRes;
import com.tiancheng.onecode.trade.notify.PayResultOrderBO;
import org.apache.ibatis.annotations.Param;

import java.util.List;

/**
 * @Author: kellen
 * @Description: 会员订单service
 * @Date: create in 2024/12/9 18:21
 */
public interface IMemberOrderService extends IService<MemberOrder> {
    /**
     * 支付请求
     * @param payOrderRequest
     */
    OrderPayApiRes pay(PayOrderRequest payOrderRequest);

    MemberOrder queryByOrderId(String orderId);

    PageInfo<QueryOrderRes> queryPlatformPage(QueryOrderReq params);

    QueryOrderDetailRes queryOrderDetail(String orderId);

    /**
     * 支付订单统计-按商户
     * @param statisticsMerchantOrderReq
     * @return
     */
    List<StatisticsMerchantOrderPayRes> statisticsByMerchant(StatisticsMerchantOrderReq statisticsMerchantOrderReq);

    /**
     * 支付结果处理
     * @param payResultOrderBO
     */
    void payResultHandler(PayResultOrderBO payResultOrderBO);
    /**
     * 总交易金额
     * @param platformMerchantId 平台关联商户id
     * @return
     */
    Integer totalPayAmount(Long platformMerchantId);
    /**
     * 总交易金额
     * @param platformMerchantId 平台关联商户id
     * @return
     */
    Integer todayPayAmount(Long platformMerchantId);

    /**
     * 查询当前商户信息
     * @param platformMerchantId 平台商户id
     * @return
     */
    QueryMerchantApiRes getMerchantInfo(Long platformMerchantId);

    /**
     * 客户端订单明细
     * @param orderId 订单号
     * @return
     */
    QueryOrderDetailApiRes queryApiOrderDetail(String orderId);


    Boolean cancelOrder(String orderId);

    /**
     * 核销订单
     * 每天凌晨核销前一天支付的订单
     */
    void verification(String dateTime);

    List<StatisticsUserOrderItemRes> statisticsByUserId(StatisticsUserOrderReq statisticsUserOrderReq);

    List<StatisticsMerchantOrderPayRes> statisticsByDay(StatisticsMerchantOrderReq statisticsMerchantOrderReq);
}
